package com.smart.village.big.screen.controller.micro;

import com.smart.village.big.screen.domain.AjaxResult;
import com.smart.village.big.screen.service.MicroSmartMoHeTouristService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import java.util.logging.Logger;

import static com.smart.village.big.screen.domain.AjaxResult.error;
import static com.smart.village.big.screen.domain.AjaxResult.success;

/**
 * 小程序-数智漠河-游客端
 */
@Tag(name = "小程序-数智漠河-游客端")
@RestController
@RequestMapping("/micro/smart/mohe/tourist")
public class MicroSmartMoHeTouristController {
    Logger logger = Logger.getLogger(MicroSmartMoHeTouristController.class.getName());
    @Autowired
    private MicroSmartMoHeTouristService microSmartMoHeTouristService;
    /**
     *  通知公告 -游客端
     *
     *
     * @return
     */
    @Operation(summary = "通知公告 -游客端 最新的10条数据")
    @GetMapping("/getNoticePublish")
    @ResponseBody

    public AjaxResult getNoticePublish(
            @RequestParam @Parameter(description = "新闻终端") String NewsTerminal,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {
            if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                pageNum = 1;
            }
            if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                pageSize = 10;
            }
            return success(microSmartMoHeTouristService.getNoticePublish( pageNum, pageSize,1,NewsTerminal));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    /**
     * 酒店公寓-搜索
     *
     * @return
     */
    @Operation(summary = "酒店公寓-搜索")
    @Parameters({
            @Parameter(name = "search", description = "搜索内容  非必填"),
            @Parameter(name = "category", description = "分类 对应 merchant_category 表中的酒店、宾馆、民宿"),
            @Parameter(name = "address", description = "地址搜索  非必填"),
            @Parameter(name = "merchantName", description = "酒店名称搜索  非必填"),
            @Parameter(name = "shopName", description = "具体哪个店铺搜索  非必填"),
            @Parameter(name = "orderCondition", description = "排序类型（订单数Check_Cnt，价格Base_Price，房间数Room_Cnt，开业年限Open_Year，距离Distance） 非必填"),
            @Parameter(name = "orderType", description = "排序类型（升序/降序） 非必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
            @Parameter(name = "distanceParam", description = "距离参数 km 非必填"),
            @Parameter(name = "beginPrice", description = "价格范围-开始 非必填"),
            @Parameter(name = "endPrice", description = "价格范围-结束 非必填"),
            @Parameter(name = "villageNumber", description = "村号 非必填"),
            @Parameter(name = "filterSearchJson", description = "筛选参数 json 形式 非必填"),
    })
    @GetMapping("getHotelApartmentsSearch")
    @ResponseBody
    public AjaxResult getHotelApartmentsSearch(
            @RequestParam(required = false) String search,
            @RequestParam String category,
            @RequestParam(required = false) String address,
            @RequestParam(required = false) String merchantName,
            @RequestParam(required = false) String shopName,
            @RequestParam(required = false) String orderCondition,
            @RequestParam(required = false) String orderType,
            @RequestParam(required = false) String currentCoords,
            @RequestParam(required = false) String distanceParam,
            @RequestParam(required = false) String beginPrice,
            @RequestParam(required = false) String endPrice,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false) String filterSearchJson,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize

    ) {
        try {
            if (StringUtils.isNotEmpty(orderCondition)) {
                if (orderCondition.equals("Distance")) {
                    if (StringUtils.isEmpty(currentCoords)) {
                        throw new RuntimeException("请获取当前位置！");
                    }
                }
            }
            return success(microSmartMoHeTouristService
                    .getHotelApartmentsSearch(search,
                            category,
                            address,
                            merchantName,
                            shopName,
                            orderCondition,
                            orderType,
                            currentCoords,
                            distanceParam,
                            beginPrice,
                            endPrice,villageNumber,filterSearchJson,
                            pageNum, pageSize)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("酒店公寓-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 酒店公寓-详情
     *
     * @return
     */
    @Operation(summary = "酒店公寓-详情")
    @Parameters({
            @Parameter(name = "shopSerialNumber", description = "店铺编号必填"),
    })
    @GetMapping("getHotelApartmentShopDetail")
    @ResponseBody
    public AjaxResult getHotelApartmentShopDetail(
            @RequestParam String shopSerialNumber,
            @RequestParam(required = false) String currentCoords
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getHotelApartmentShopDetail(shopSerialNumber,currentCoords));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("酒店公寓-详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 酒店公寓-详情-菜品-分页
     *
     * @return
     */
    @Operation(summary = "酒店公寓-详情-菜品-分页")
    @Parameters({
            @Parameter(name = "shopSerialNumber", description = "店铺编号必填"),
            @Parameter(name = "pageNum", description = "当前页数 非必填"),
            @Parameter(name = "pageSize", description = "每页条数 非必填"),

    })
    @GetMapping("getHotelApartmentShopDetailDishInfoPage")
    @ResponseBody
    public AjaxResult getHotelApartmentShopDetailDishInfoPage(
            @RequestParam String shopSerialNumber,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getHotelApartmentShopDetailDishInfoPage(shopSerialNumber,pageNum,pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("酒店公寓-详情-菜品-分页失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 酒店公寓-房间类型-详情
     *
     * @return
     */
    @Operation(summary = "酒店公寓-房间类型-详情")
    @Parameters({
            @Parameter(name = "roomTypeSerialNumber", description = "房间类型编号必填"),
    })
    @GetMapping("getHotelApartmentRoomTypeDetail")
    @ResponseBody
    public AjaxResult getHotelApartmentRoomTypeDetail(
            @RequestParam String roomTypeSerialNumber
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getHotelApartmentRoomTypeDetail(roomTypeSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("酒店公寓-房间类型列表: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 景区全览-所有标签
     *
     * @return
     */
    @Operation(summary = "景区全览-所有标签")
    @Parameters({
    })
    @GetMapping("getScenicSpotAllTagList")
    @ResponseBody
    public AjaxResult getScenicSpotAllTagList(
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getScenicSpotAllTagList());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("景区全览-所有标签: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }


    /**
     * 旅游线路-所有分类
     *
     * @return
     */
    @Operation(summary = "旅游线路-所有分类")
    @Parameters({
    })
    @GetMapping("getTouristRouteAllTypeList")
    @ResponseBody
    public AjaxResult getTouristRouteAllTypeList(
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getTouristRouteAllTypeList());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("旅游线路-所有分类: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 景区全览-列表
     *
     * @return
     */
    @Operation(summary = "景区全览-列表")
    @Parameters({
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
            @Parameter(name = "search", description = "搜索 非必填"),
            @Parameter(name = "scenicSpotTagSerialNumber", description = "标签id 非必填"),
    })
    @GetMapping("getScenicSpotList")
    @ResponseBody
    public AjaxResult getScenicSpotList(
            @RequestParam(required = false) String currentCoords,
            @RequestParam(required = false) String search,
            @RequestParam(required = false) String scenicSpotTagSerialNumber,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getScenicSpotList(currentCoords,scenicSpotTagSerialNumber,search, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("景区全览-列表失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 景区全览-景区详情
     *
     * @return
     */
    @Operation(summary = "景区全览-景区详情")
    @Parameters({
            @Parameter(name = "scenicSpotSerialNumber", description = "景区编号必填"),
    })
    @GetMapping("getScenicSpotDetail")
    @ResponseBody
    public AjaxResult getScenicSpotDetail(
            @RequestParam String scenicSpotSerialNumber
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getScenicSpotDetail(scenicSpotSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("景区全览-景区详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 景区全览-景区攻略
     *
     * @return
     */
    @Operation(summary = "景区全览-景区攻略")
    @Parameters({
            @Parameter(name = "scenicSpotSerialNumber", description = "景区编号必填"),
            @Parameter(name = "pageNum", description = "页码 非必填"),
            @Parameter(name = "pageSize", description = "每页数量 非必填"),
    })
    @GetMapping("getScenicSpotStrategy")
    @ResponseBody
    public AjaxResult getScenicSpotStrategy(
            @RequestParam String scenicSpotSerialNumber,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getScenicSpotStrategy(scenicSpotSerialNumber, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("景区全览-景区攻略失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 景区全览-景区攻略-详情
     *
     * @return
     */
    @Operation(summary = "景区全览-景区攻略-详情")
    @Parameters({
            @Parameter(name = "scenicSpotStrategySerialNumber", description = "景区攻略编号必填"),
    })
    @GetMapping("getScenicSpotStrategyDetail")
    @ResponseBody
    public AjaxResult getScenicSpotStrategyDetail(
            @RequestParam String scenicSpotStrategySerialNumber
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getScenicSpotStrategyDetail(scenicSpotStrategySerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("景区全览-景区攻略-详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 旅游线路-列表
     *
     * @return
     */
    @Operation(summary = "旅游线路-列表")
    @Parameters({
            @Parameter(name = "touristRouteType", description = "对应 tourist_route_type 表中的类型 非必填"),
            @Parameter(name = "search", description = "搜索 非必填"),
    })
    @GetMapping("getTouristRouteList")
    @ResponseBody
    public AjaxResult getTouristRouteList(
            @RequestParam(required = false) String touristRouteType,
            @RequestParam(required = false) String search,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getTouristRouteList(touristRouteType, search,pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("旅游线路-列表失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 旅游线路-线路详情
     *
     * @return
     */
    @Operation(summary = "旅游线路-线路详情")
    @Parameters({
            @Parameter(name = "touristRouteSerialNumber", description = "线路编号必填"),
    })
    @GetMapping("getTouristRouteDetail")
    @ResponseBody
    public AjaxResult getTouristRouteDetail(
            @RequestParam String touristRouteSerialNumber
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getTouristRouteDetail(touristRouteSerialNumber));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("旅游线路-线路详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 美食标签
     *
     * @return
     */
    @Operation(summary = "美食标签")
    @Parameters({
    })
    @GetMapping("getMerchantAliasTypeAllList")
    @ResponseBody
    public AjaxResult getMerchantAliasTypeAllList(
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getMerchantAliasTypeAllList());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("美食标签: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 美食-搜索
     *
     * @return
     */
    @Operation(summary = "美食-搜索")
    @Parameters({
            @Parameter(name = "address", description = "地址搜索  非必填"),
            @Parameter(name = "merchantName", description = "酒店名称搜索  非必填"),
            @Parameter(name = "shopName", description = "具体哪个店铺搜索  非必填"),
            @Parameter(name = "orderCondition", description = "排序类型（订单数Check_Cnt，价格Base_Price，房间数Room_Cnt，开业年限Open_Year，距离Distance） 非必填"),
            @Parameter(name = "orderType", description = "排序类型（升序/降序） 非必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
            @Parameter(name = "merchantAliasTypeSerialNumber", description = "美食标签 多个id逗号分隔 非必填"),
            @Parameter(name = "distanceParam", description = "距离 非必填"),
            @Parameter(name = "beginPrice", description = "价格范围 非必填"),
            @Parameter(name = "endPrice", description = "价格范围 非必填"),
    })
    @GetMapping("getDeliciousFoodSearch")
    @ResponseBody
    public AjaxResult getDeliciousFoodSearch(
            @RequestParam(required = false) String address,
            @RequestParam(required = false) String merchantName,
            @RequestParam(required = false) String shopName,
            @RequestParam(required = false) String orderCondition,
            @RequestParam(required = false) String orderType,
            @RequestParam(required = false) String currentCoords,
            @RequestParam(required = false) String merchantAliasTypeSerialNumber,
            @RequestParam(required = false) String distanceParam,
            @RequestParam(required = false) String beginPrice,
            @RequestParam(required = false) String endPrice,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize

    ) {
        try {
            if (StringUtils.isNotEmpty(orderCondition)) {
                if (orderCondition.equals("Distance")) {
                    if (StringUtils.isEmpty(currentCoords)) {
                        throw new RuntimeException("请获取当前位置！");
                    }
                }
            }
            return success(microSmartMoHeTouristService
                    .getDeliciousFoodSearch(
                            address,
                            merchantName,
                            shopName,
                            orderCondition,
                            orderType,
                            currentCoords,merchantAliasTypeSerialNumber,distanceParam,beginPrice,endPrice, pageNum, pageSize)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("美食-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 美食-详情
     *
     * @return
     */
    @Operation(summary = "美食-详情")
    @Parameters({
            @Parameter(name = "shopSerialNumber", description = "店铺编号必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
    })
    @GetMapping("getDeliciousFoodShopDetail")
    @ResponseBody
    public AjaxResult getDeliciousFoodShopDetail(
            @RequestParam String shopSerialNumber,
            @RequestParam(required = false) String currentCoords

            ) {
        try {
            return success(microSmartMoHeTouristService
                    .getDeliciousFoodShopDetail(shopSerialNumber,currentCoords));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("美食-详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }


    /**
     * 店铺-搜索
     *
     * @return
     */
    @Operation(summary = "店铺-搜索")
    @Parameters({
            @Parameter(name = "search", description = "搜索  非必填"),
            @Parameter(name = "address", description = "地址搜索  非必填"),
            @Parameter(name = "merchantName", description = "商家名称搜索  非必填"),
            @Parameter(name = "shopName", description = "店铺名称搜索  非必填"),
            @Parameter(name = "orderCondition", description = "排序类型（价格Base_Price，距离Distance） 非必填"),
            @Parameter(name = "orderType", description = "排序类型（升序/降序） 非必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
            @Parameter(name = "merchantAliasTypeSerialNumber", description = "美食标签 多个id逗号分隔 非必填"),
            @Parameter(name = "distanceParam", description = "距离 非必填"),
            @Parameter(name = "beginPrice", description = "价格范围 非必填"),
            @Parameter(name = "endPrice", description = "价格范围 非必填"),
            @Parameter(name = "shopType", description = "店铺类型 必填  商超、美食"),
            @Parameter(name = "villageNumber", description = "村社编号"),
    })
    @GetMapping("getShopSearch")
    @ResponseBody
    public AjaxResult getShopSearch(
            @RequestParam(required = false) String search,
            @RequestParam(required = false) String address,
            @RequestParam(required = false) String merchantName,
            @RequestParam(required = false) String shopName,
            @RequestParam(required = false) String orderCondition,
            @RequestParam(required = false) String orderType,
            @RequestParam(required = false) String currentCoords,
            @RequestParam(required = false) String merchantAliasTypeSerialNumber,
            @RequestParam(required = false) String distanceParam,
            @RequestParam(required = false) String beginPrice,
            @RequestParam(required = false) String endPrice,
            @RequestParam(defaultValue = "美食") String shopType,
            @RequestParam(required = false) String villageNumber,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize

    ) {
        try {
            if (StringUtils.isNotEmpty(orderCondition)) {
                if (orderCondition.equals("Distance")) {
                    if (StringUtils.isEmpty(currentCoords)) {
                        throw new RuntimeException("请获取当前位置！");
                    }
                }
            }
            return success(microSmartMoHeTouristService
                    .getShopSearch(search,
                            address,
                            merchantName,
                            shopName,
                            orderCondition,
                            orderType,
                            currentCoords,merchantAliasTypeSerialNumber,distanceParam,beginPrice,endPrice, shopType,villageNumber, pageNum, pageSize)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("店铺-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 店铺-详情
     *
     * @return
     */
    @Operation(summary = "店铺-详情")
    @Parameters({
            @Parameter(name = "shopSerialNumber", description = "店铺编号必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
            @Parameter(name = "shopType", description = "店铺类型 必填 商超、美食"),
    })
    @GetMapping("getShopDetail")
    @ResponseBody
    public AjaxResult getShopDetail(
            @RequestParam String shopSerialNumber,
            @RequestParam(required = false) String currentCoords,
            @RequestParam String shopType

    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getShopDetail(shopSerialNumber,currentCoords,shopType));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("店铺-详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }


    /**
     * 店铺标签
     *
     * @return
     */
    @Operation(summary = "店铺标签")
    @Parameters({
            @Parameter(name = "shopType", description = "店铺类型 必填 商超、美食"),
    })
    @GetMapping("getShopAliasTypeAllList")
    @ResponseBody
    public AjaxResult getShopAliasTypeAllList(
            @RequestParam String shopType
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getShopAliasTypeAllList(shopType));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("店铺标签: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 商超标签
     *
     * @return
     */
    @Operation(summary = "商超标签")
    @Parameters({
    })
    @GetMapping("getSuperMarkerTypeAllList")
    @ResponseBody
    public AjaxResult getSuperMarkerTypeAllList(
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getSuperMarkerTypeAllList());
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("商超标签: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 商超-搜索
     *
     * @return
     */
    @Operation(summary = "商超-搜索")
    @Parameters({
            @Parameter(name = "search", description = "搜索  非必填"),
            @Parameter(name = "address", description = "地址搜索  非必填"),
            @Parameter(name = "merchantName", description = "酒店名称搜索  非必填"),
            @Parameter(name = "shopName", description = "具体哪个店铺搜索  非必填"),
            @Parameter(name = "orderCondition", description = "排序类型（订单数Check_Cnt，价格Base_Price，房间数Room_Cnt，开业年限Open_Year，距离Distance） 非必填"),
            @Parameter(name = "orderType", description = "排序类型（升序/降序） 非必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
    })
    @GetMapping("getSuperMarkerSearch")
    @ResponseBody
    public AjaxResult getSuperMarkerSearch(
            @RequestParam(required = false) String search,
            @RequestParam(required = false) String address,
            @RequestParam(required = false) String merchantName,
            @RequestParam(required = false) String shopName,
            @RequestParam(required = false) String orderCondition,
            @RequestParam(required = false) String orderType,
            @RequestParam(required = false) String currentCoords,
            @RequestParam(required = false) String merchantAliasTypeSerialNumber,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize

    ) {
        try {
            if (StringUtils.isNotEmpty(orderCondition)) {
                if (orderCondition.equals("Distance")) {
                    if (StringUtils.isEmpty(currentCoords)) {
                        throw new RuntimeException("请获取当前位置！");
                    }
                }
            }
            return success(microSmartMoHeTouristService
                    .getSuperMarkerSearch(
                            search,
                            address,
                            merchantName,
                            shopName,
                            orderCondition,
                            orderType,
                            currentCoords,merchantAliasTypeSerialNumber, pageNum, pageSize)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("商超-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 商超-详情
     *
     * @return
     */
    @Operation(summary = "商超-详情")
    @Parameters({
            @Parameter(name = "shopSerialNumber", description = "店铺编号必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
    })
    @GetMapping("getSuperMarkerShopDetail")
    @ResponseBody
    public AjaxResult getSuperMarkerShopDetail(
            @RequestParam String shopSerialNumber,
            @RequestParam(required = false) String currentCoords

    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getSuperMarkerShopDetail(shopSerialNumber,currentCoords));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("商超-详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 店铺评论
     *
     * @return
     */
    @Operation(summary = "店铺评论")
    @GetMapping("getShopDetailComments")
    @ResponseBody
    public AjaxResult getShopDetailComments(
            @RequestParam @Parameter(description = "店铺id") String shopSerialNumber,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeTouristService.
                                getShopDetailComments(shopSerialNumber, "4", pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 农产品名称搜索
     *
     * @return
     */
    @Operation(summary = "农产品名称搜索")
    @Parameters({
            @Parameter(name = "agriculturalSuppliesStoreGoodsTypeSerialNumber", description = "农产品分类  非必填"),
            @Parameter(name = "goodsName", description = "农产品名称搜索  非必填"),
    })
    @GetMapping("getAgriculturalGoodsSearch")
    @ResponseBody
    public AjaxResult getAgriculturalGoodsSearch(
            @RequestParam(required = false) String agriculturalSuppliesStoreGoodsTypeSerialNumber,
            @RequestParam(required = false) String goodsName,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize

    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getAgriculturalGoodsSearch(
                            agriculturalSuppliesStoreGoodsTypeSerialNumber, goodsName, pageNum, pageSize)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("农产品名称搜索-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 农产品详情
     *
     * @return
     */
    @Operation(summary = "农产品详情")
    @Parameters({
            @Parameter(name = "agriculturalSuppliesStoreGoodsSerialNumber", description = "农产品详情id  非必填"),
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
    })
    @GetMapping("getAgriculturalGoodsDetail")
    @ResponseBody
    public AjaxResult getAgriculturalGoodsDetail(
            @RequestParam String agriculturalSuppliesStoreGoodsSerialNumber,
                    @RequestParam(required = false) String currentCoords
    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getAgriculturalGoodsDetail(agriculturalSuppliesStoreGoodsSerialNumber,currentCoords)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("农产品详情-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }
    /**
     * 农产品分类
     *
     * @return
     */
    @Operation(summary = "农产品分类")
    @Parameters({

    })
    @GetMapping("getAgriculturalGoodsType")
    @ResponseBody
    public AjaxResult getAgriculturalGoodsType(
    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getAgriculturalGoodsType()
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("农产品分类-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }
    /**
     * 我的-我的预定列表
     *
     * @return
     */
    @Operation(summary = "我的-我的预定列表")
    @Parameters({
            @Parameter(name = "phone", description = "电话号"),
            @Parameter(name = "status", description = "状态 非必填 0 已预定 "),
    })
    @GetMapping("getMyBookRoomList")
    @ResponseBody
    public AjaxResult getMyBookRoomList(
            @RequestParam String phone,
            @RequestParam(required = false) String status,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getMyBookRoomList(phone, status, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("我的-我的预定列表失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }
    /**
     * 我的-我的预定详情
     *
     * @return
     */
    @Operation(summary = "我的-我的预定详情")
    @Parameters({

    })
    @GetMapping("getMyBookRoomDetail")
    @ResponseBody
    public AjaxResult getMyBookRoomDetail(
            @RequestParam String phone,
            @RequestParam String roomTypeBookingsSerialNumber
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getMyBookRoomDetail(roomTypeBookingsSerialNumber,phone));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("我的-我的预定详情失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }
    /**
     * 我的评论-店铺
     *
     * @return
     */
    @Operation(summary = "我的评论-店铺")
    @GetMapping("getMyShopComments")
    @ResponseBody
    @Parameters({
            @Parameter(name = "phone", description = "手机号"),
            @Parameter(name = "pageNum", description = "当前页数"),
            @Parameter(name = "pageSize", description = "每页条数"),
            @Parameter(name = "shopType", description = "店铺类型 必填  商超、美食、民宿"),
    })
    public AjaxResult getMyShopComments(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false)  String shopType,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeTouristService.
                                getMyShopComments(phone, "4",shopType, pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的投诉
     *
     * @return
     */
    @Operation(summary = "我的投诉")
    @GetMapping("getMyComplaints")
    @ResponseBody
    public AjaxResult getMyComplaints(
            @RequestParam @Parameter(description = "手机号") String phone,
            @RequestParam(required = false) @Parameter(description = "草稿、处理中、待评价、已评价")  String status,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeTouristService.
                                getMyComplaints(phone, status,pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的投诉
     *
     * @return
     */
    @Operation(summary = "我的投诉-草稿数量")
    @GetMapping("getMyComplaintsDraftCnt")
    @ResponseBody
    public AjaxResult getMyComplaintsDraftCnt
    (
            @RequestParam @Parameter(description = "手机号") String phone
        ) {
        {
            try {

                return success(
                        microSmartMoHeTouristService.
                                getMyComplaintsDraftCnt(phone));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }

    /**
     * 我的投诉详情
     *
     * @return
     */
    @Operation(summary = "我的投诉详情")
    @Parameters({
            @Parameter(name = "complaintId", description = "投诉详情id"),
    })
    @GetMapping("getMyComplaintsDetail")
    @ResponseBody
    public AjaxResult getMyComplaintsDetail(
            @RequestParam String complaintId
    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getMyComplaintsDetail(complaintId)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("我的投诉详情-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 首页轮播-游客端
     *
     * @return
     */
    @Operation(summary = "首页轮播-游客端")
    @Parameters({
    })
    @GetMapping("getCarouselConfig")
    @ResponseBody
    public AjaxResult getCarouselConfig(
    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getCarouselConfig()
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("商超-搜索失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 热门筛选 - 商超美食 的 附近按钮，酒店民宿的位置距离 按钮
     *
     * @return
     */
    @Operation(summary = "热门筛选 - 商超美食 的 附近按钮")
    @Parameters({
    })
    @GetMapping("getHotFilter")
    @ResponseBody
    public AjaxResult getHotFilter(
            String shopType
    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getHotFilter(shopType)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("热门筛选: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 大搜索-下面的热搜列表
     *
     * @return
     */
    @Operation(summary = "大搜索-下面的热搜列表")
    @Parameters({
    })
    @GetMapping("getBigSearchHotFilterDataList")
    @ResponseBody
    public AjaxResult getBigSearchHotFilterDataList(
           @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
           @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize
    ) {
        try {

            return success(microSmartMoHeTouristService
                    .getBigSearchHotFilterDataList(pageNum,pageSize)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("大搜索-下面的热搜列表: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    @Operation(summary = "酒店民宿-筛选按钮-下拉数据")
    @Parameters({
    })
    @GetMapping("getHotelFilterDataList")
    @ResponseBody
    public AjaxResult getHotelFilterDataList(
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getHotelFilterDataList()
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("酒店民宿-筛选按钮-下拉数据: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    @Operation(summary = "大搜索，二级页面的搜索接口-列表不分页-按照美团那么做，返回名称类型和图片")
    @GetMapping("getAllListSearch")
    @ResponseBody
    public AjaxResult getAllListSearch(
            @RequestParam @Parameter(description = "搜索") String search
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getAllListSearch(search)
            );
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("大搜索，二级页面的搜索接口: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }

    /**
     * 小程序-游客端 账户信息 从member_account_info取
     * @param openld
     * @return
     */
    @Operation(summary = " 小程序-游客端 账户信息 从member_account_info取")
    @Parameters({
            @Parameter(name = "openld", description = "openld"),
    })
    @GetMapping("/getMicroAccountInformation")
    @ResponseBody
    public AjaxResult getMicroAccountInformation(
            @RequestParam String openld
    ){
        try {
            return success(microSmartMoHeTouristService.getMicroAccountInformation(openld));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }

    /**
     * 小程序-游客端 更新账户信息
     * @param openld
     * @param Union_ID
     * @param Contact_Phone
     * @param Member_Nike
     * @param Image
     * @param Sex
     * @param App_ID
     * @return
     */
    @Operation(summary = " 小程序-游客端 账户信息 从member_account_info取")

    @GetMapping("/updateMemberAccountInfo")
    @ResponseBody
    public AjaxResult updateMemberAccountInfo(
            @RequestParam String openld,
            @RequestParam(required = false) String Union_ID,
            @RequestParam(required = false) String Contact_Phone,
            @RequestParam(required = false) String Member_Nike,
            @RequestParam(required = false) String Image,
            @RequestParam(required = false) String Sex,
            @RequestParam(required = false) String Birthday,
            @RequestParam(required = false) String App_ID
    ){
        try {
            return success(microSmartMoHeTouristService.updateMemberAccountInfo(openld,Union_ID,Contact_Phone,Member_Nike,Image,Sex,Birthday,App_ID));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe(e.getMessage());
            return error("程序错误请联系系统管理员");
        }
    }
    /**
     * 停车场
     *
     * @return
     */
    @Operation(summary = "停车场-列表")
    @Parameters({
            @Parameter(name = "currentCoords", description = "当前位置坐标 非必填"),
            @Parameter(name = "search", description = "搜索 非必填"),
    })
    @GetMapping("getParkingList")
    @ResponseBody
    public AjaxResult getParkingList(
            @RequestParam(required = false) String currentCoords,
            @RequestParam(required = false) String search,
            @RequestParam(required = false,defaultValue = "50") String km,
            @RequestParam(required = false, defaultValue = "1") int pageNum,
            @RequestParam(required = false, defaultValue = "10") int pageSize
    ) {
        try {
            return success(microSmartMoHeTouristService
                    .getParkingList(currentCoords,search,km, pageNum, pageSize));
        } catch (Exception e) {
            e.printStackTrace();
            logger.severe("停车场-列表失败: " + e.getMessage());
            return AjaxResult.error(e.getMessage());
        }
    }
    /**
     * 商家红黑榜
     *
     * @return
     */
    @Operation(summary = "商家红黑榜")
    @GetMapping("getShopBlackWhiteList")
    @ResponseBody
    @Parameters({

            @Parameter(name = "shopType", description = "店铺类型 必填：  商超、美食、酒店民宿"),
            @Parameter(name = "rankType", description = "榜单 必填： 红榜 黑榜"),
            @Parameter(name = "pageNum", description = "当前页数"),
            @Parameter(name = "pageSize", description = "每页条数"),
    })
    public AjaxResult getShopBlackWhiteList(
            @RequestParam  String shopType,
            @RequestParam String rankType,
            @RequestParam(required = false, defaultValue = "1") @Parameter(description = "当前页数") int pageNum,
            @RequestParam(required = false, defaultValue = "10") @Parameter(description = "每页条数") int pageSize) {
        {
            try {
                if (ObjectUtils.isEmpty(pageNum) || pageNum == 0) {
                    pageNum = 1;
                }
                if (ObjectUtils.isEmpty(pageSize) || pageSize == 0) {
                    pageSize = 10;
                }
                return success(
                        microSmartMoHeTouristService.
                                getShopBlackWhiteList( "4",rankType,shopType, pageNum, pageSize));
            } catch (Exception e) {
                e.printStackTrace();
                logger.severe(e.getMessage());
                return error("程序错误请联系系统管理员");
            }
        }
    }
}
